#include "hunBase.h"
#include "hunString_test.h"
// ----------------------------------------------------------------------------
#define SizeCheck(arg1,arg2) \
    if( arg2 != hunString_Size(arg1)) \
        return __LINE__
hunInt hunString_Size_Test()
{
    SizeCheck("hello", 5);
    SizeCheck("",0);
    SizeCheck("1",1);
    SizeCheck("test test test",14);
    SizeCheck("This,is,a,test.",15);
    return 0;
}
// ----------------------------------------------------------------------------
#define LengthCheck(arg1,arg2) \
    if( arg2 != hunString_Length(arg1)) \
        return __LINE__
hunInt hunString_Length_Test()
{
    LengthCheck("hello", 5);
    LengthCheck("",0);
    LengthCheck("1",1);
    LengthCheck("test test test",14);
    LengthCheck("This,is,a,test.",15);
    return 0;
}
// ----------------------------------------------------------------------------
#define BeginCheck(arg1,arg2) \
    if( arg2 != hunString_Begin(arg1))\
        return __LINE__
hunInt hunString_Begin_Test()
{
    BeginCheck("this", 0);
    BeginCheck(" ohoh",1);
    BeginCheck("  2",2);
    BeginCheck("\n",0);
    BeginCheck("     \n",5);
    return 0;
}
// ----------------------------------------------------------------------------
#define EndCheck(arg1,arg2) \
    if( arg2 != hunString_End(arg1))\
        return __LINE__
hunInt hunString_End_Test()
{
    EndCheck("ohmygod", 6);
    EndCheck("hello ", 4);
    EndCheck("hello   ", 4);
    EndCheck("hello world ", 10);
    EndCheck("hello world", 10);
    EndCheck("hello world               ", 10);
    EndCheck("hello world  \n\n  ", 10);
    return 0;
}
// ----------------------------------------------------------------------------
#define CompareCheck(arg1,arg2,arg3) \
    if( arg3 != hunString_Compare(arg1,arg2))\
        return __LINE__
hunInt hunString_Compare_Test()
{
    CompareCheck("this","this",0);
    CompareCheck("take a look!","take a look!",0);
    CompareCheck("take a look at this!","take a look at thus!",-1);
    CompareCheck("this","THIS",1);
    CompareCheck("this"," this",1);
    return 0;
}
// ----------------------------------------------------------------------------
#define FindCheck(arg1,arg2,arg3) \
    if( arg3 != hunString_Find(arg1,arg2))\
        return __LINE__
hunInt hunString_Find_Test()
{
    FindCheck("this is a test lol","is",2);
    FindCheck("this is a test lol","loll",-1);
    FindCheck("this is a test lol","lol",15);
    FindCheck("this is a test lol","this",0);
    FindCheck("this is a test lol","test",10);
    return 0;
}
// ----------------------------------------------------------------------------
